import React, { Component } from 'react';
import { Upload, Icon } from 'antd';

class UploadDemo extends Component {
  constructor(props) {
    super(props);
    this.state = {
      fileList: [
        // {
        //   uid: '-1',
        //   name: 'image.png',
        //   status: 'done',
        //   url: 'https://zos.alipayobjects.com/rmsportal/jkjgkEfvpUPVyRjUImniVslZfWPnJuuZ.png',
        // },
      ],
    };
  }

  render() {
    const { fileList } = this.state;

    return (
      <div className="clearfix">
        <Upload
          // action="https://www.mocky.io/v2/5cc8019d300000980a055e76"
          listType="picture-card"
          fileList={fileList}
          onChange={({ fileList: fList }) => {
            this.setState({ fileList: fList });
          }}
          headers={{
            'Sec-Fetch-Mode': 'cors',
          }}
        >
          <div>
            <Icon type="plus" />
            <div>上传</div>
          </div>
        </Upload>
      </div>
    );
  }
}

export default UploadDemo;
